<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<ul id="section_list">
  <% @categories.each do |c| %>
    <li id="section_<%= c.id %>" class="section <%= "active" if c == @category %>">
      <span class="section_url">
        <a class="name edit_section_link" href="<%= c.slug.presence && eportfolio_named_category_path(c.eportfolio, c.slug) %>"><%= c.name %></a>
        <%= render partial: 'eportfolios/section_settings', locals: { title: c.name, section_url: eportfolio_category_path(c.eportfolio, c.id) } %>
      </span>
      <a class="rename_section_url" href="<%= eportfolio_category_path(c.eportfolio, c.id) %>" style="display: none;"></a>
    </li>
  <% end %>
  <li id="section_blank" class="section unsaved" style="display: none;">
    <span class="section_url">
      <a class="name edit_section_link" href="<%= eportfolio_named_category_path(@portfolio, "{{ slug }}") %>">{{#t}}Section Name{{/t}}</a>
      <%= render partial: 'eportfolios/section_settings', locals: { title: t("Section Name"), section_url: eportfolio_category_path(@portfolio.id, "{{ id }}") } %>
    </span>
    <a class="rename_section_url" style="display: none;" href="<%= eportfolio_category_path(@portfolio, "{{ id }}") %>"></a>
  </li>
</ul>
<ul style="font-size: 0.8em;line-height: 1.85em; font-style: italic; margin-left: 10px;" id="section_list_manage">
  <li style="display: none;" class="add_section"><button type="button" class="Button Button--link add_section_link no-hover icon-add">{{#t}}Add Section{{/t}}</button></li>
  <li style="display: none;">
    <a href="<%= eportfolio_categories_path(@portfolio) %>" class="add_section_url"></a>
    <a href="<%= eportfolio_reorder_categories_path(@portfolio.id) %>" class="reorder_sections_url"></a>
  </li>
  <% if can_do(@portfolio, @current_user, :manage) %>
    <li class="displaying_item"><button type="button" class="Button Button--link manage_sections_link" title="{{#t}}Add, remove or rearrange sections for this portfolio{{/t}}"><%= manage_sections_link_text %></button></li>
    <li class="editing_item" style="padding-bottom: 10px;"><button type="button" class="Button Button--primary Button--small done_editing_button">{{#t}}Done Editing{{/t}}</button></li>
    <li><button type="button" class="Button Button--link portfolio_settings_link">{{#t}}ePortfolio Settings{{/t}}</button></li>
  <% end %>
</ul>
<span id="section_name_holder" class="section_url" style="display: none;">
  <input type="text" id="section_name"/>
</span>
